﻿/*-------------------------------------------------------------------------
* 命名空间: MyToDo.ViewModels/MemoViewModel
* 类       名: MemoViewModel
* 功      能:  TD
* 时      间:  2023/12/14 11:31:56
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using MyToDo.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyToDo.ViewModels
{
    public class MemoViewModel : BindableBase
    {
        public MemoViewModel()
        {
            MemoList = new ObservableCollection<MemoEntity>();
            InitMemoList();

            AddMemoCommand = new DelegateCommand(DoAddMemoCommand);
        }


        private void InitMemoList()
        {
            for (int i = 1; i < 21; i++)
            {
                MemoList.Add(new MemoEntity() { Title = "标题 " + i, Content = "测试数据..." });
            }
        }

        public DelegateCommand AddMemoCommand { get; private set; }
        private void DoAddMemoCommand()
        {
            IsRightDrawerOpen = true;
        }




        private bool isRightDrawerOpen;

        public bool IsRightDrawerOpen
        {
            get { return isRightDrawerOpen; }
            set
            {
                isRightDrawerOpen = value;
                RaisePropertyChanged();
            }
        }


        private ObservableCollection<MemoEntity> memoList = null!;

        public ObservableCollection<MemoEntity> MemoList
        {
            get { return memoList; }
            set
            {
                memoList = value;
                RaisePropertyChanged();
            }
        }

    }
}
